
<div class="layui-form-item">
	<label class="layui-form-label">${name}：</label>
	<div class="layui-input-block">			
		<div class="layui-select-title">
			<input type="text" id="${id}" placeholder="请选择" readonly="true" lay-verify="required" class="layui-input" value="${value}"/>
			<input type="hidden" id="${hidden}" name="${hidden}" value="${hiddenValue!}"/>
			<i class="layui-edge"></i>
		</div>
	</div>
</div>
<script>
	layui.use(['layer','tree'],function(){
		var $ = layui.jquery;
		var layer = layui.layer;
		var id  = "${id}";
		var url = "${url}";
		var hiddenId = "${hidden}";
		var hidden = $("#"+hiddenId);
		$("#"+id).click(function(){
			var self = this;
			var selNode = null;
			layer.open({
				content:"<ul id='demo'></ul>",
				title:"上级",
				yes:function(index,layero){
					if(!selNode) layer.msg("未选择父节点",{
			            icon: 2
			        });
					else{
						self.value = selNode.name;
						hidden.val(selNode.${hiddenName!hidden});						
						layer.close(index);
					}
						
				}
			});
			
			$.get(url,{},function(data){
				
				options = {
					  	   elem: '#demo' //传入元素选择器
						  ,nodes: data
						  ,click:function(node){
							  selNode = node;
						  }
						};
				layui.tree(options);
			});
			

		});
	});
</script>